package org.eminem.spring.cloud.finchley.controller;

import org.eminem.spring.cloud.finchley.model.User;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;


@RestController
@RequestMapping("/user")
public class UserController {

    @GetMapping(value = "/add")
    public String addUser(User user, HttpServletRequest request) {
        String token = request.getHeader("oauthToken");
        return "hello," + user.getName();
    }

    @PostMapping(value = "/update")
    public String updateUser(@RequestBody User user) {
        return "hello," + user.getName();
    }


}
